//
//  XMGRecemondCategoryCell.m
//  百思不得姐
//
//  Created by 杨庆 on 2016/12/31.
//  Copyright © 2016年 杨庆. All rights reserved.
//

#import "XMGRecemondCategoryCell.h"
#import "XMGRecemondCategory.h"

@interface XMGRecemondCategoryCell()
@property (weak, nonatomic) IBOutlet UIView *selectedIndicator;

@end

@implementation XMGRecemondCategoryCell

- (void)awakeFromNib {
    [super awakeFromNib];
	
	self.backgroundColor=XMGColor(244, 244, 244);
	
//	self.textLabel.textColor=XMGColor(78, 78, 78);
//	self.textLabel.highlightedTextColor = XMGColor(219, 21, 26);
//	
//	//cell选中 时的背景色
//	UIView*bg=[[UIView alloc]init];
//	bg.backgroundColor=[UIColor clearColor];
//	self.selectedBackgroundView=bg;
	
}
-(void)setCategory:(XMGRecemondCategory *)category{
	_category=category;
	
	self.textLabel.text=category.name;
}

-(void)layoutSubviews{
	[super layoutSubviews];
	self.textLabel.y =2;
	self.textLabel.height=self.contentView.height-2*self.textLabel.y;
	
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
	[super setSelected:selected animated:animated];
	
	//默认是不选中
	self.selectedIndicator.hidden=!selected;
	//如果选中:显示和指示器一样的颜色, 如果没选中文字设置成初始化时的颜色
	self.textLabel.textColor= selected ?self.selectedIndicator.backgroundColor:XMGColor(78, 78, 78);
	
}
@end
